<template>
  <div class="app-container">
    <el-table
    :data="list"
    height="250"
    border
    style="width: 100%">
    <el-table-column type="index" label="#" width="30">
    </el-table-column>
    <el-table-column
      prop="userName"
      label="用户名"
      width="180">
    </el-table-column>
    <el-table-column
      prop="password"
      label="密码"
      width="180">
    </el-table-column>
    <el-table-column
      prop="addTime"
      label="添加时间">
    </el-table-column>
    <el-table-column
    label="账户状态">
    <template slot-scope="scope" >
      <span class="svg-container red" v-if="scope.row.status == '0'">
        <p>正常</p>
      </span>
      <span class="svg-container green" v-else>
        <p>禁用</p>
      </span>
    </template>
  </el-table-column>
  </el-table>

  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { queryUser } from '@/api/user'
export default {
  data() {
    return {
      btnLoading: false,
      userId: '',
      list: []
    }
  },
  computed: {
    ...mapGetters([
      'token'
    ])
  },
  created() {
    this.userId = this.token
    this.getNetData()
  },
  activated() {
    // 取列表
    this.getNetData()
  },
  deactivated() {
  },
  methods: {
    getNetData() {
      this.listLoading = true
      return queryUser().then(response => {
        var newItem = response.data
        this.list = newItem
        // // this.listQuery.page.total = response.totalpages * this.listQuery.page.size
        // this.listQuery.page.total = response.totalData
        this.listLoading = false
      }).catch(err => {
        err
        this.listLoading = false
      })
    }
  }
}
</script>

<style scoped>
</style>
